import request from '@/utils/request'

// 查询账号管理列表
export function listCommonUser(query) {
  return request({
    url: '/user/commonUser/list',
    method: 'get',
    params: query
  })
}

// 查询账号管理详细
export function getCommonUser(userId) {
  return request({
    url: '/user/commonUser/' + userId,
    method: 'get'
  })
}

// 新增账号管理
export function addCommonUser(data) {
  return request({
    url: '/user/commonUser',
    method: 'post',
    data: data
  })
}

// 修改账号管理
export function updateCommonUser(data) {
  return request({
    url: '/user/commonUser',
    method: 'put',
    data: data
  })
}

// 删除账号管理
export function delCommonUser(userId) {
  return request({
    url: '/user/commonUser/' + userId,
    method: 'delete'
  })
}
export function getUserDetail(userId) {
  return request({
    url: '/user/commonUser/detail/' + userId,
    method: 'get'
  })
}
export function getEmailCode(email) {
  return request({
    url: '/emailCode/' + email,
    method: 'get'
  })
}
export function getPhoneCode(phone) {
  return request({
    url: '/phoneCode/' + phone,
    method: 'get'
  })
}
export function updateUserEmail(data) {
  return request({
    url: '/user/commonUser/updateEmail',
    method: 'put',
    data: data
  })
}
export function updateUserPhone(data) {
  return request({
    url: '/user/commonUser/updatePhone',
    method: 'put',
    data: data
  })
}
export function updateUserDetail(data) {
  return request({
    url: '/user/commonUser/detail/update',
    method: 'put',
    data: data
  })
}
export function getExerciseTarget() {
  return request({
    url: '/user/commonUser/exerciseTarget',
    method: 'get'
  })
}
export function updateExerciseTarget(data) {
  return request({
    url: '/user/commonUser/exerciseTarget',
    method: 'put',
    data: data
  })
}


